package test;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.net.InetAddress;
import java.net.Socket;
import java.net.UnknownHostException;

public class EchoClient
{
	public static void main( String[] args ) throws UnknownHostException, IOException
	{
		Socket socket;
		BufferedReader in;
		try
		{
			socket = new Socket( InetAddress.getLocalHost(), 2009 );
			System.out.println( "Demande de connexion" );

			in = new BufferedReader( new InputStreamReader( socket.getInputStream() ) );
			String message_distant = in.readLine();
			System.out.println( message_distant );

			socket.close();

		}
		catch ( UnknownHostException e )
		{
			e.printStackTrace();
		}
		catch ( IOException e )
		{
			e.printStackTrace();
		}
	}
}
